package top.as.sean.common.guava;

import lombok.Data;

import java.util.concurrent.BlockingDeque;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;

/**
 * guava线程池初始化数据
 *
 * @author: ArchieSean
 * @create: 2022/11/6
 */
@Data
public class GuavaProperties {
    /**
     * guava缓存的键值数
     */
    private Integer numMaxSize = 1000;
    /**
     * guava更新缓存的下一次时间,分钟
     */
    private Integer refreshWriteTime = 10;
    /**
     * 线程池核心线程数
     */
    private Integer corePoolSize = 3;
    /**
     * 线程池最大线程
     */
    private Integer maximumPoolSize = 10;
    /**
     * 线程存活时间
     */
    private Long keepAliveTime = 10L;
    /**
     * 任务队列
     */
    private BlockingDeque<Runnable> workQueue = new LinkedBlockingDeque<>(10);
    /**
     * 线程工厂
     */
    private ThreadFactory threadFactory = Executors.defaultThreadFactory();
    /**
     * 任务拒绝策略
     */
    private RejectedExecutionHandler handler = new ThreadPoolExecutor.AbortPolicy();
}
